package com.xywy.fwc;

import java.util.Iterator;

import org.json.JSONObject;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.support.v4.util.LogWriter;
import android.util.Log;

public class FwcConstant {
   public static final String APPKEY = "PQ8hje23jfklde2pRuktvVZ";
//   public static final String URL_HOME_DOCTOR = "http://3gnew.club.xywy.com/familyDoctor?yunjk=1";
   public static final String URL_HOME_DOCTOR = "http://api.3g.club.xywy.com/familydoctor.php?type=user_orders";
   public static final String URL_QUESTION = "http://app.3g.club.xywy.com/ask.php?yunjk=1";
   public static String ADD_SIGNVALUE = "KHy69gsk8%#@kl$";
   public static String ADD_TAG = "zj";
   public static String H5KEY = "3d6acecedd8c263f851bbb1e8e96a9f1";
   public static String H5PAY_URL = "http://app.3g.club.xywy.com/familyDoctor/order/success?yunjk=1&";

   public static String H5X_URl = "http://app.3g.club.xywy.com/doctor_center.php?yunjk=1&";
   public static String H5_PIC_URl ="http://app.3g.club.xywy.com/ask.php?yunjk=1&";

   public static String ADD_LIST_URL = "http://api.wws.xywy.com/index.php?act=zhuanjia&fun=Plus&";
   
   public static String ASK_URL = "http://api.club.xywy.com/mobile_cloudhealth.php?act=question&";
   
   public static String ASK_KEY = "3d6acecedd8c263f851bbb1e8e96a9f1";

   public static String DOCTOR_URL ="http://app.3g.club.xywy.com/familyDoctor?yunjk=1&";

   public static String TEL_URL = "http://api.club.xywy.com/400_notify.php?";

   public static String PUSh_URL = "http://api.yun.xywy.com/index.php/app/notifications/service_provider";
   
   public static String ADD_DETAIL_URL = "http://3g.i.xywy.com/expert/appointment/";
   public static final String STR_MYQUESTION = "10000"; 
   public static final String STR_MYDOCTOR = "10001";
   public static final String STR_MYADD = "10002";
   public static final String STR_MYREDUCE= "10004";
   public static final String STR_MYHEALTH= "10005";
   
   public static final String FWC_MESSAGE = "fwcmessage";
   
   public static final String CLEAR_MESSAGE_URL = " http://api.yun.xywy.com/index.php/app/notifications/clear/";
   
   public static final String MY_ADDDETIAL_URL = "http://3g.zhuanjia.xywy.com/se/plus_expert.php?yunjk=1&";
   public static final String ADDKEY = "334aa6176ad9cc0b5891e943a04c5d1c";
   public static final String MY_ADDOUT_URL = "http://3g.zhuanjia.xywy.com/se/plus_expert.php?yunjk=1";
//   public static final String MY_ADDOUT_URL =   "http://203.130.45.171/se/plus_expert.php?yunjk=1";
   public static final String FWC_ACTIVITY_URL ="http://api.yun.xywy.com/index.php/server/api/ad/ad_list/service_provider/";
   
   
   public static void keepFwcMessages(String str,Context context){
	   SharedPreferences sp = context.getSharedPreferences("config", Context.MODE_PRIVATE);
	   try {
			JSONObject data = new JSONObject(str);
			JSONObject json = data.optJSONObject("data");
			int count = json.optInt("count");
			if(count >0){
				Editor editor = sp.edit();
				editor.putInt(FWC_MESSAGE, count);
				JSONObject list = json.optJSONObject("list");
				Iterator<String> iter = list.keys();
				while (iter.hasNext()) {
					String str_key = iter.next();
					editor.putInt(str_key, list.optInt(str_key));
				}
				editor.commit();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
   }
   
   public static int getMessageCount(String str,Context context){
	   SharedPreferences sp = context.getSharedPreferences("config", Context.MODE_PRIVATE);
	   return sp.getInt(str, 0);
   }
   
   public static void setMessageCount(String str,Context context,int count){
	   SharedPreferences sp = context.getSharedPreferences("config", Context.MODE_PRIVATE);
	   sp.edit().putInt(str, count).commit();
   }
}
